package com.rework.joss.bsgrid.web;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.rework.joss.bsgrid.base.BaseController;
import com.rework.joss.bsgrid.entity.SysUser;
import com.rework.joss.bsgrid.service.SysUserService;

@Controller
@RequestMapping("/test/bsgird")
public class SysUserController extends BaseController {
	@Autowired
	private SysUserService sysUserService;

	@RequestMapping("/list")
	public String userList(HttpServletRequest request, HttpServletResponse response) throws Exception{
		int curPage = getPageNum(request);
		int limit = getInternal(request);
		String sortName = getSortName(request);
		String sortOrder = getSortOrder(request);
		
		int records  = sysUserService.queryCountUser();
		String orderby = " "+sortName+" "+sortOrder+" ";
		List<SysUser> list = sysUserService.queryUser(orderby,getRecordStart(records, curPage, limit), limit);
		
		
		processJsonData4Grid(request, response, limit, curPage, records, list);
		
		return null;
	}
}
